package mylibrary.jndi.self;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
import javax.naming.spi.InitialContextFactoryBuilder;
import javax.naming.spi.NamingManager;

public class MyInitialContextFactoryBuilder implements InitialContextFactoryBuilder {

	public static void initialize() {
		try {
			NamingManager.setInitialContextFactoryBuilder(new MyInitialContextFactoryBuilder());
		} catch (NamingException e) {
			e.printStackTrace();
		}
	}
	
	public InitialContextFactory createInitialContextFactory(
			Hashtable<?, ?> environment) throws NamingException {
		return new MyInitialContextFactory();
	}

}
